package com.neusoft.neuiotms.dcam.common.converter;

import com.neusoft.bizcore.web.dto.AbstractConverter;
import com.neusoft.neuiotms.dcam.common.dto.DcamResidentUserDTO;
import com.neusoft.neuiotms.dcam.common.model.DcamResidentUser;
import org.springframework.stereotype.Component;

@Component
public class DcamResidentUserConverter extends AbstractConverter<DcamResidentUser, DcamResidentUserDTO> {
    @Override
    public DcamResidentUser toModel(DcamResidentUserDTO dto) {
        final DcamResidentUser model = new DcamResidentUser();
        model.setName(dto.getName());
        model.setUsername(dto.getUsername());
        return model;
    }

    @Override
    public DcamResidentUserDTO toDTO(DcamResidentUser model, boolean forListView) {
        final DcamResidentUserDTO dto = new DcamResidentUserDTO();
        dto.setId(model.getId());
        dto.setName(model.getName());
        dto.setUsername(model.getUsername());
        return dto;
    }
}
